/**
 * Created by Administrator on 2016/9/12.
 */
function http(obj, callback){
    if( typeof obj != 'object') return false;
    var url = 'http://www.uhuigo168.com/index.php',
        json = getJson(obj);
    $.ajax({
        url: url,
        type: 'POST',
        data: { json : json},
        contentType: "application/x-www-form-urlencoded",
        dataType: 'json',
        success: function(data){
            callback(data);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(errorThrown);
        }
    });
}
function concat(obj){
    if( typeof obj != 'object') return '';
    var ks = Object.keys(obj), objKeys = [], str = '';
    if( !ks.length )    return '';
    objKeys = ks.sort();
    for(var i in objKeys){
        str += obj[objKeys[i]];
    }
    return str;
}
function getJson(obj){
    if( typeof obj != 'object') return false;
    var token = '1e56c95504a9a846e4c7043704a20f25', sign = concat(obj) + token;
    obj.token = md5(sign);
    return JSON.stringify(obj);
}